package com.cloudm.technician.ui.modules.common.home

import android.os.Bundle
import com.cloudm.technician.R
import com.cloudm.technician.extensions.addFragmentToActivity
import com.cloudm.technician.extensions.openActivity
import com.cloudm.technician.ui.base.BaseActivity
import com.cloudm.technician.ui.modules.personal.personal_center.PersonalCenterActivity

/**
 * 作者: wesley
 * 时间: 2017/12/13
 * 描述: 首页
 */
class HomeActivity : BaseActivity() {

    private var flag = 0

    override val optionsMenuEnabled: Boolean
        get() = false

    override fun handleBundle(bundle: Bundle) {
        flag = bundle.getInt("flag", 0)
    }

    override fun initVariables() {

    }

    override fun initViews(savedInstanceState: Bundle?) {
        headerTitle = R.string.home
        customerNavigationIcon = R.mipmap.ic_home_user

        val fragment = manager.findFragmentById(
                R.id.common_content) as? HomeFragment ?: HomeFragment.newInstance(flag)
        addFragmentToActivity(manager, fragment)
    }

    override fun initListener() {

    }


    override fun onIndicatorClick() {
        openActivity(PersonalCenterActivity::class.java, false)
    }
}